1
|
|
|
/*! |
2
|
|
|
* @name ElkArte Forum |
3
|
|
|
* @copyright ElkArte Forum contributors |
4
|
|
|
* @license BSD http://opensource.org/licenses/BSD-3-Clause |
5
|
|
|
* |
6
|
|
|
* This file contains code covered by: |
7
|
|
|
* copyright: 2011 Simple Machines (http://www.simplemachines.org) |
8
|
|
|
* license: BSD, See included LICENSE.TXT for terms and conditions. |
9
|
|
|
* |
10
|
|
|
* @version 1.1 |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* This file contains javascript surrounding personal messages send form. |
15
|
|
|
*/ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Personal message Send controller |
19
|
|
|
* |
20
|
|
|
* sSelf: instance name |
21
|
|
|
* sSessionId: |
22
|
|
|
* sSessionVar: |
23
|
|
|
* sTextDeleteItem: text string to show when |
24
|
|
|
* sToControlId: id of the to auto suggest input |
25
|
|
|
* aToRecipients: array of members its going to |
26
|
|
|
* aBccRecipients: array of member to BCC |
27
|
|
|
* sBccControlId: id of the bcc auto suggest input |
28
|
|
|
* sBccDivId: container holding the bbc input |
29
|
|
|
* sBccDivId2: container holding the bcc chosen name |
30
|
|
|
* sBccLinkId: link to show/hide the bcc names |
31
|
|
|
* sBccLinkContainerId: container for the above |
32
|
|
|
* bBccShowByDefault: boolean to show it on or off |
33
|
|
|
* sShowBccLinkTemplate: |
34
|
|
|
* |
35
|
|
|
* @param {type} oOptions |
36
|
|
|
*/ |
37
|
|
|
function elk_PersonalMessageSend(oOptions) |
38
|
|
|
{ |
39
|
|
|
this.opt = oOptions; |
40
|
|
|
this.oBccDiv = null; |
41
|
|
|
this.oBccDiv2 = null; |
42
|
|
|
this.oToAutoSuggest = null; |
43
|
|
|
this.oBccAutoSuggest = null; |
44
|
|
|
this.oToListContainer = null; |
45
|
|
|
this.init(); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
// Initialise the PM recipient selection area |
49
|
|
|
elk_PersonalMessageSend.prototype.init = function() |
50
|
|
|
{ |
51
|
|
|
if (!this.opt.bBccShowByDefault) |
52
|
|
|
{ |
53
|
|
|
// Hide the BCC control. |
54
|
|
|
this.oBccDiv = document.getElementById(this.opt.sBccDivId); |
55
|
|
|
this.oBccDiv.style.display = 'none'; |
56
|
|
|
this.oBccDiv2 = document.getElementById(this.opt.sBccDivId2); |
57
|
|
|
this.oBccDiv2.style.display = 'none'; |
58
|
|
|
|
59
|
|
|
// Show the link to bet the BCC control back. |
60
|
|
|
var oBccLinkContainer = document.getElementById(this.opt.sBccLinkContainerId); |
61
|
|
|
oBccLinkContainer.style.display = 'inline'; |
62
|
|
|
oBccLinkContainer.innerHTML = this.opt.sShowBccLinkTemplate; |
63
|
|
|
|
64
|
|
|
// Make the link show the BCC control. |
65
|
|
|
var oBccLink = document.getElementById(this.opt.sBccLinkId); |
66
|
|
|
oBccLink.instanceRef = this; |
67
|
|
|
oBccLink.onclick = function() { |
68
|
|
|
this.instanceRef.showBcc(); |
69
|
|
|
return false; |
70
|
|
|
}; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
var oToControl = document.getElementById(this.opt.sToControlId); |
|
|
|
|
74
|
|
|
this.oToAutoSuggest = new smc_AutoSuggest({ |
|
|
|
|
75
|
|
|
sSelf: this.opt.sSelf + '.oToAutoSuggest', |
76
|
|
|
sSessionId: this.opt.sSessionId, |
77
|
|
|
sSessionVar: this.opt.sSessionVar, |
78
|
|
|
sSuggestId: 'to_suggest', |
79
|
|
|
sControlId: this.opt.sToControlId, |
80
|
|
|
sSearchType: 'member', |
81
|
|
|
sPostName: 'recipient_to', |
82
|
|
|
sURLMask: 'action=profile;u=%item_id%', |
83
|
|
|
sTextDeleteItem: this.opt.sTextDeleteItem, |
84
|
|
|
bItemList: true, |
85
|
|
|
sItemListContainerId: 'to_item_list_container', |
86
|
|
|
aListItems: this.opt.aToRecipients |
87
|
|
|
}); |
88
|
|
|
this.oToAutoSuggest.registerCallback('onBeforeAddItem', this.opt.sSelf + '.callbackAddItem'); |
89
|
|
|
|
90
|
|
|
this.oBccAutoSuggest = new smc_AutoSuggest({ |
91
|
|
|
sSelf: this.opt.sSelf + '.oBccAutoSuggest', |
92
|
|
|
sSessionId: this.opt.sSessionId, |
93
|
|
|
sSessionVar: this.opt.sSessionVar, |
94
|
|
|
sSuggestId: 'bcc_suggest', |
95
|
|
|
sControlId: this.opt.sBccControlId, |
96
|
|
|
sSearchType: 'member', |
97
|
|
|
sPostName: 'recipient_bcc', |
98
|
|
|
sURLMask: 'action=profile;u=%item_id%', |
99
|
|
|
sTextDeleteItem: this.opt.sTextDeleteItem, |
100
|
|
|
bItemList: true, |
101
|
|
|
sItemListContainerId: 'bcc_item_list_container', |
102
|
|
|
aListItems: this.opt.aBccRecipients |
103
|
|
|
}); |
104
|
|
|
this.oBccAutoSuggest.registerCallback('onBeforeAddItem', this.opt.sSelf + '.callbackAddItem'); |
105
|
|
|
}; |
106
|
|
|
|
107
|
|
|
// Show the bbc fields |
108
|
|
|
elk_PersonalMessageSend.prototype.showBcc = function() |
109
|
|
|
{ |
110
|
|
|
// No longer hide it, show it to the world! |
111
|
|
|
this.oBccDiv.style.display = 'block'; |
112
|
|
|
this.oBccDiv2.style.display = 'block'; |
113
|
|
|
}; |
114
|
|
|
|
115
|
|
|
// Prevent items to be added twice or to both the 'To' and 'Bcc'. |
116
|
|
|
elk_PersonalMessageSend.prototype.callbackAddItem = function(oAutoSuggestInstance, sSuggestId) |
117
|
|
|
{ |
118
|
|
|
this.oToAutoSuggest.deleteAddedItem(sSuggestId); |
119
|
|
|
this.oBccAutoSuggest.deleteAddedItem(sSuggestId); |
120
|
|
|
|
121
|
|
|
return true; |
122
|
|
|
}; |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Populate the label selection pulldown after a message is selected |
126
|
|
|
*/ |
127
|
|
|
function loadLabelChoices() |
128
|
|
|
{ |
129
|
|
|
var listing = document.forms.pmFolder.elements, |
130
|
|
|
theSelect = document.forms.pmFolder.pm_action, |
131
|
|
|
add, |
|
|
|
|
132
|
|
|
remove, |
|
|
|
|
133
|
|
|
toAdd = {length: 0}, |
134
|
|
|
toRemove = {length: 0}; |
135
|
|
|
|
136
|
|
|
if (theSelect.childNodes.length === 0) |
137
|
|
|
return; |
138
|
|
|
|
139
|
|
|
// This is done this way for internationalization reasons. |
140
|
|
|
if (!('-1' in allLabels)) |
|
|
|
|
141
|
|
|
{ |
142
|
|
|
for (var o = 0; o < theSelect.options.length; o++) |
143
|
|
|
if (theSelect.options[o].value.substr(0, 4) === "rem_") |
144
|
|
|
allLabels[theSelect.options[o].value.substr(4)] = theSelect.options[o].text; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
for (var i = 0; i < listing.length; i++) |
148
|
|
|
{ |
149
|
|
|
if (listing[i].name !== "pms[]" || !listing[i].checked) |
150
|
|
|
continue; |
151
|
|
|
|
152
|
|
|
var alreadyThere = [], |
153
|
|
|
x; |
154
|
|
|
|
155
|
|
|
for (x in currentLabels[listing[i].value]) |
|
|
|
|
156
|
|
|
{ |
157
|
|
|
if (!(x in toRemove)) |
158
|
|
|
{ |
159
|
|
|
toRemove[x] = allLabels[x]; |
160
|
|
|
toRemove.length++; |
161
|
|
|
} |
162
|
|
|
alreadyThere[x] = allLabels[x]; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
for (x in allLabels) |
166
|
|
|
{ |
167
|
|
|
if (!(x in alreadyThere)) |
168
|
|
|
{ |
169
|
|
|
toAdd[x] = allLabels[x]; |
170
|
|
|
toAdd.length++; |
171
|
|
|
} |
172
|
|
|
} |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
while (theSelect.options.length > 2) |
176
|
|
|
theSelect.options[2] = null; |
177
|
|
|
|
178
|
|
|
if (toAdd.length !== 0) |
179
|
|
|
{ |
180
|
|
|
theSelect.options[theSelect.options.length] = new Option(txt_pm_msg_label_apply); |
|
|
|
|
181
|
|
|
theSelect.options[theSelect.options.length - 1].innerHTML = txt_pm_msg_label_apply; |
182
|
|
|
theSelect.options[theSelect.options.length - 1].className = 'jump_to_header'; |
183
|
|
|
theSelect.options[theSelect.options.length - 1].disabled = true; |
184
|
|
|
|
185
|
|
|
for (i in toAdd) |
186
|
|
|
{ |
187
|
|
|
if (i !== "length") |
188
|
|
|
theSelect.options[theSelect.options.length] = new Option(toAdd[i], "add_" + i); |
189
|
|
|
} |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
if (toRemove.length !== 0) |
193
|
|
|
{ |
194
|
|
|
theSelect.options[theSelect.options.length] = new Option(txt_pm_msg_label_remove); |
|
|
|
|
195
|
|
|
theSelect.options[theSelect.options.length - 1].innerHTML = txt_pm_msg_label_remove; |
196
|
|
|
theSelect.options[theSelect.options.length - 1].className = 'jump_to_header'; |
197
|
|
|
theSelect.options[theSelect.options.length - 1].disabled = true; |
198
|
|
|
|
199
|
|
|
for (i in toRemove) |
200
|
|
|
{ |
201
|
|
|
if (i !== "length") |
202
|
|
|
theSelect.options[theSelect.options.length] = new Option(toRemove[i], "rem_" + i); |
203
|
|
|
} |
204
|
|
|
} |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* Rebuild the rule description! |
209
|
|
|
* @todo: string concatenation is bad for internationalization |
210
|
|
|
*/ |
211
|
|
|
function rebuildRuleDesc() |
212
|
|
|
{ |
213
|
|
|
// Start with nothing. |
214
|
|
|
var text = "", |
215
|
|
|
joinText = "", |
216
|
|
|
actionText = "", |
217
|
|
|
hadBuddy = false, |
218
|
|
|
foundCriteria = false, |
219
|
|
|
foundAction = false, |
220
|
|
|
curNum, |
221
|
|
|
curVal, |
222
|
|
|
curDef; |
223
|
|
|
|
224
|
|
|
// GLOBAL strings, convert to objects |
225
|
|
|
/** global: groups */ |
226
|
|
|
if (typeof groups === "string") |
227
|
|
|
groups = JSON.parse(groups); |
228
|
|
|
/** global: labels */ |
229
|
|
|
if (typeof labels === "string") |
230
|
|
|
labels = JSON.parse(labels); |
231
|
|
|
/** global: rules */ |
232
|
|
|
if (typeof rules === "string") |
233
|
|
|
rules = JSON.parse(rules); |
234
|
|
|
|
235
|
|
|
for (var i = 0; i < document.forms.addrule.elements.length; i++) |
236
|
|
|
{ |
237
|
|
|
if (document.forms.addrule.elements[i].id.substr(0, 8) === "ruletype") |
238
|
|
|
{ |
239
|
|
|
if (foundCriteria) |
240
|
|
|
joinText = document.getElementById("logic").value === 'and' ? ' ' + txt_pm_readable_and + ' ' : ' ' + txt_pm_readable_or + ' '; |
|
|
|
|
241
|
|
|
else |
242
|
|
|
joinText = ''; |
243
|
|
|
|
244
|
|
|
foundCriteria = true; |
245
|
|
|
|
246
|
|
|
curNum = document.forms.addrule.elements[i].id.match(/\d+/); |
247
|
|
|
curVal = document.forms.addrule.elements[i].value; |
248
|
|
|
|
249
|
|
|
if (curVal === "gid") |
250
|
|
|
curDef = document.getElementById("ruledefgroup" + curNum).value.php_htmlspecialchars(); |
251
|
|
|
else if (curVal !== "bud") |
252
|
|
|
curDef = document.getElementById("ruledef" + curNum).value.php_htmlspecialchars(); |
253
|
|
|
else |
254
|
|
|
curDef = ""; |
255
|
|
|
|
256
|
|
|
// What type of test is this? |
257
|
|
|
if (curVal === "mid" && curDef) |
258
|
|
|
text += joinText + txt_pm_readable_member.replace("{MEMBER}", curDef); |
|
|
|
|
259
|
|
|
else if (curVal === "gid" && curDef && groups[curDef]) |
260
|
|
|
text += joinText + txt_pm_readable_group.replace("{GROUP}", groups[curDef]); |
|
|
|
|
261
|
|
|
else if (curVal === "sub" && curDef) |
262
|
|
|
text += joinText + txt_pm_readable_subject.replace("{SUBJECT}", curDef); |
|
|
|
|
263
|
|
|
else if (curVal === "msg" && curDef) |
264
|
|
|
text += joinText + txt_pm_readable_body.replace("{BODY}", curDef); |
|
|
|
|
265
|
|
|
else if (curVal === "bud" && !hadBuddy) |
266
|
|
|
{ |
267
|
|
|
text += joinText + txt_pm_readable_buddy; |
|
|
|
|
268
|
|
|
hadBuddy = true; |
269
|
|
|
} |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
if (document.forms.addrule.elements[i].id.substr(0, 7) === "acttype") |
273
|
|
|
{ |
274
|
|
|
if (foundAction) |
275
|
|
|
joinText = ' ' + txt_pm_readable_and + ' '; |
276
|
|
|
else |
277
|
|
|
joinText = ""; |
278
|
|
|
|
279
|
|
|
foundAction = true; |
280
|
|
|
|
281
|
|
|
curNum = document.forms.addrule.elements[i].id.match(/\d+/); |
282
|
|
|
curVal = document.forms.addrule.elements[i].value; |
283
|
|
|
|
284
|
|
|
if (curVal === "lab") |
285
|
|
|
curDef = document.getElementById("labdef" + curNum).value.php_htmlspecialchars(); |
286
|
|
|
else |
287
|
|
|
curDef = ""; |
288
|
|
|
|
289
|
|
|
// Now pick the actions. |
290
|
|
|
if (curVal === "lab" && curDef && labels[curDef]) |
291
|
|
|
actionText += joinText + txt_pm_readable_label.replace("{LABEL}", labels[curDef]); |
|
|
|
|
292
|
|
|
else if (curVal === "del") |
293
|
|
|
actionText += joinText + txt_pm_readable_delete; |
|
|
|
|
294
|
|
|
} |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
// If still nothing make it default! |
298
|
|
|
if (text === "" || !foundCriteria) |
299
|
|
|
text = txt_pm_rule_not_defined; |
|
|
|
|
300
|
|
|
else |
301
|
|
|
{ |
302
|
|
|
if (actionText !== "") |
303
|
|
|
text += ' ' + txt_pm_readable_then + ' ' + actionText; |
|
|
|
|
304
|
|
|
text = txt_pm_readable_start + text + txt_pm_readable_end; |
|
|
|
|
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
// Set the actual HTML! |
308
|
|
|
document.getElementById("ruletext").innerHTML = text; |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
function initUpdateRulesActions() |
312
|
|
|
{ |
313
|
|
|
/** |
314
|
|
|
* Maintains the personal message rule options to conform with the rule choice |
315
|
|
|
* so that the form only makes available the proper choices (input, select, none, etc) |
316
|
|
|
*/ |
317
|
|
|
|
318
|
|
|
// Handy shortcuts |
319
|
|
|
var $criteria = $('#criteria'), |
320
|
|
|
$actions = $('#actions'); |
321
|
|
|
|
322
|
|
|
$criteria.on('change', '[name^="ruletype"]', function() { |
323
|
|
|
var optNum = $(this).data('optnum'); |
324
|
|
|
|
325
|
|
|
if (document.getElementById("ruletype" + optNum).value === "gid") |
326
|
|
|
{ |
327
|
|
|
document.getElementById("defdiv" + optNum).style.display = "none"; |
328
|
|
|
document.getElementById("defseldiv" + optNum).style.display = "inline"; |
329
|
|
|
} |
330
|
|
|
else if (document.getElementById("ruletype" + optNum).value === "bud" || document.getElementById("ruletype" + optNum).value === "") |
331
|
|
|
{ |
332
|
|
|
document.getElementById("defdiv" + optNum).style.display = "none"; |
333
|
|
|
document.getElementById("defseldiv" + optNum).style.display = "none"; |
334
|
|
|
} |
335
|
|
|
else |
336
|
|
|
{ |
337
|
|
|
document.getElementById("defdiv" + optNum).style.display = "inline"; |
338
|
|
|
document.getElementById("defseldiv" + optNum).style.display = "none"; |
339
|
|
|
} |
340
|
|
|
}); |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* Maintains the personal message rule action options to conform with the action choice |
344
|
|
|
* so that the form only makes available the proper choice |
345
|
|
|
*/ |
346
|
|
|
$actions.on('change', '[name^="acttype"]', function() { |
347
|
|
|
var optNum = $(this).data('actnum'); |
348
|
|
|
|
349
|
|
|
if (document.getElementById("acttype" + optNum).value === "lab") |
350
|
|
|
{ |
351
|
|
|
document.getElementById("labdiv" + optNum).style.display = "inline"; |
352
|
|
|
} |
353
|
|
|
else |
354
|
|
|
{ |
355
|
|
|
document.getElementById("labdiv" + optNum).style.display = "none"; |
356
|
|
|
} |
357
|
|
|
}); |
358
|
|
|
|
359
|
|
|
// Trigger a change on the existing in order to let the function run |
360
|
|
|
$criteria.find('[name^="ruletype"]').change(); |
361
|
|
|
$actions.find('[name^="acttype"]').change(); |
362
|
|
|
|
363
|
|
|
// Make sure the description is rebuilt every time something changes, even on elements not yet existing |
364
|
|
|
$criteria.on('change keyup', |
365
|
|
|
'[name^="ruletype"], [name^="ruledefgroup"], [name^="ruledef"], [name^="acttype"], [name^="labdef"], #logic', |
366
|
|
|
function() { |
367
|
|
|
rebuildRuleDesc(); |
368
|
|
|
}); |
369
|
|
|
|
370
|
|
|
// Make sure the description is rebuilt every time something changes, even on elements not yet existing |
371
|
|
|
$('#criteria, #actions').on('change keyup', |
372
|
|
|
'[name^="ruletype"], [name^="ruledefgroup"], [name^="ruledef"], [name^="acttype"], [name^="labdef"], #logic', |
373
|
|
|
function() { |
374
|
|
|
rebuildRuleDesc(); |
375
|
|
|
}); |
376
|
|
|
|
377
|
|
|
// Rebuild once at the beginning to ensure everything is correct |
378
|
|
|
rebuildRuleDesc(); |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* Add a new rule criteria for PM filtering |
383
|
|
|
*/ |
384
|
|
|
function addCriteriaOption() |
385
|
|
|
{ |
386
|
|
|
if (criteriaNum === 0) |
|
|
|
|
387
|
|
|
{ |
388
|
|
|
for (var i = 0; i < document.forms.addrule.elements.length; i++) |
389
|
|
|
if (document.forms.addrule.elements[i].id.substr(0, 8) === "ruletype") |
390
|
|
|
criteriaNum++; |
|
|
|
|
391
|
|
|
} |
392
|
|
|
criteriaNum++; |
393
|
|
|
|
394
|
|
|
// Global strings, convert to objects |
395
|
|
|
/** global: groups */ |
396
|
|
|
if (typeof groups === "string") |
397
|
|
|
groups = JSON.parse(groups); |
398
|
|
|
/** global: labels */ |
399
|
|
|
if (typeof labels === "string") |
400
|
|
|
labels = JSON.parse(labels); |
401
|
|
|
/** global: rules */ |
402
|
|
|
if (typeof rules === "string") |
403
|
|
|
rules = JSON.parse(rules); |
404
|
|
|
|
405
|
|
|
// rules select |
406
|
|
|
var rules_option = '', |
407
|
|
|
index = ''; |
408
|
|
|
|
409
|
|
|
for (index in rules) |
410
|
|
|
{ |
411
|
|
|
if (rules.hasOwnProperty(index)) |
412
|
|
|
rules_option += '<option value="' + index + '">' + rules[index] + '</option>'; |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
// group selections |
416
|
|
|
var group_option = ''; |
417
|
|
|
|
418
|
|
|
for (index in groups) |
419
|
|
|
group_option += '<option value="' + index + '">' + groups[index] + '</option>'; |
420
|
|
|
|
421
|
|
|
setOuterHTML(document.getElementById("criteriaAddHere"), '<br />' + |
422
|
|
|
'<select class="criteria" name="ruletype[' + criteriaNum + ']" id="ruletype' + criteriaNum + '" data-optnum="' + criteriaNum + '">' + |
423
|
|
|
'<option value="">' + txt_pm_rule_criteria_pick + ':</option>' + rules_option + '' + |
|
|
|
|
424
|
|
|
'</select> ' + |
425
|
|
|
'<span id="defdiv' + criteriaNum + '" class="hide">' + |
426
|
|
|
'<input type="text" name="ruledef[' + criteriaNum + ']" id="ruledef' + criteriaNum + '" value="" class="input_text" />' + |
427
|
|
|
'</span>' + |
428
|
|
|
'<span id="defseldiv' + criteriaNum + '" class="hide">' + |
429
|
|
|
'<select class="criteria" name="ruledefgroup[' + criteriaNum + ']" id="ruledefgroup' + criteriaNum + '">' + |
430
|
|
|
'<option value="">' + txt_pm_rule_sel_group + '</option>' + group_option + |
|
|
|
|
431
|
|
|
'</select>' + |
432
|
|
|
'</span>' + |
433
|
|
|
'<span id="criteriaAddHere"></span>'); |
434
|
|
|
|
435
|
|
|
return false; |
436
|
|
|
} |
437
|
|
|
|
438
|
|
|
/** |
439
|
|
|
* Add a new action for a defined PM rule |
440
|
|
|
*/ |
441
|
|
|
function addActionOption() |
442
|
|
|
{ |
443
|
|
|
if (actionNum === 0) |
|
|
|
|
444
|
|
|
{ |
445
|
|
|
for (var i = 0; i < document.forms.addrule.elements.length; i++) |
446
|
|
|
if (document.forms.addrule.elements[i].id.substr(0, 7) === "acttype") |
447
|
|
|
actionNum++; |
|
|
|
|
448
|
|
|
} |
449
|
|
|
actionNum++; |
450
|
|
|
|
451
|
|
|
// Label selections |
452
|
|
|
var label_option = '', |
453
|
|
|
index = ''; |
454
|
|
|
|
455
|
|
|
if (typeof labels === "string") |
456
|
|
|
labels = JSON.parse(labels); |
457
|
|
|
for (index in labels) |
458
|
|
|
label_option += '<option value="' + index + '">' + labels[index] + '</option>'; |
459
|
|
|
|
460
|
|
|
setOuterHTML(document.getElementById("actionAddHere"), '<br />' + |
461
|
|
|
'<select name="acttype[' + actionNum + ']" id="acttype' + actionNum + '" data-actnum="' + actionNum + '">' + |
462
|
|
|
'<option value="">' + txt_pm_rule_sel_action + ':</option>' + |
|
|
|
|
463
|
|
|
'<option value="lab">' + txt_pm_rule_label + '</option>' + |
|
|
|
|
464
|
|
|
'<option value="del">' + txt_pm_rule_delete + '</option>' + |
|
|
|
|
465
|
|
|
'</select> ' + |
466
|
|
|
'<span id="labdiv' + actionNum + '" class="hide">' + |
467
|
|
|
'<select name="labdef[' + actionNum + ']" id="labdef' + actionNum + '">' + |
468
|
|
|
'<option value="">' + txt_pm_rule_sel_label + '</option>' + label_option + |
|
|
|
|
469
|
|
|
'</select></span>' + |
470
|
|
|
'<span id="actionAddHere"></span>'); |
471
|
|
|
} |
472
|
|
|
|